<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>设置推荐位</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="/static/layuiadmin/layui/css/layui.css" media="all">
</head>
<body>


<div class="layui-form" lay-filter="layuiadmin-form-role" id="layuiadmin-form-role" style="padding: 20px 30px 0 0;">

  <input type="hidden" name="id" value="{if $info}{$info.id}{/if}">

  <div class="layui-form-item">
    <label class="layui-form-label">标题</label>
    <div class="layui-input-block">
      <input type="text" name="title" lay-verify="required|title" placeholder="请输入推荐位标题" autocomplete="off" class="layui-input" value="{if $info}{$info.title}{/if}">
    </div>
  </div>
  
  <div class="layui-form-item">
    <label class="layui-form-label">英文标题</label>
    <div class="layui-input-block">
      <input type="text" name="en_title" placeholder="请输入推荐位英文标题" autocomplete="off" class="layui-input" value="{if $info}{$info.en_title}{/if}">
    </div>
  </div>

  <div class="layui-form-item">
    <label class="layui-form-label">代理商</label>
    <div class="layui-input-block">
      <select name="agent_id" lay-verify="required" lay-search>
        <option value="">请选择</option>
		<option value="0" {if $info && $info.agent_id == '0'}selected{/if}>分销平台</option>
        {foreach $agents as $k => $v}
        <option value="{$v.id}" {if $info && $info.agent_id == $v.id}selected{/if}>{$v.account}【{$v.remarks}】</option>
        {/foreach}
      </select>
    </div>
  </div>

  <div class="layui-form-item">
    <label class="layui-form-label">频道</label>
    <div class="layui-input-block">
        <input type="radio" name="freq" value="0" title="无区分" {if !$info || $info.freq == 0}checked{/if}>
        <input type="radio" name="freq" value="1" title="男频" {if $info && $info.freq == 1}checked{/if}>
        <input type="radio" name="freq" value="2" title="女频" {if $info && $info.freq == 2}checked{/if}>
    </div>
  </div>


  <div class="layui-form-item layui-form-text">
    <label class="layui-form-label">描述</label>
    <div class="layui-input-block">
      <textarea name="desc" placeholder="推荐位描述，可不填" class="layui-textarea">{if $info}{$info.desc}{/if}</textarea>
    </div>
  </div>

  <div class="layui-form-item layui-hide">
    <button class="layui-btn" lay-submit lay-filter="LAY-user-role-submit" id="LAY-user-role-submit">提交</button>
  </div>
</div>


<script src="/static/layuiadmin/layui/layui.js"></script>
<script>
  layui.config({
    base: '/static/layuiadmin/' //静态资源所在路径
  }).extend({
    index: 'lib/index' //主入口模块
  }).use(['index', 'form'], function(){
    var $ = layui.$
            ,admin = layui.admin
            ,form = layui.form;


    /* 自定义验证规则 */
    form.verify({
      title: function(value){
        if(value.length > 16){
          return '字数过长';
        }
      }
    });

  });
</script>
</body>
</html>
